李守中

ZFS 踩坑

Table of Contents

1. ZFS Volume 不能作为 SWAP

使用 zvol 来创建 swap 可能会导致操作系统死锁。详见 https://github.com/openzfs/zfs/issues/7734

直到 2023 年这个 Bug 还没有修好。

2. ZFS Pool scrub 后 error 没有消失

执行 zpool scrub mymir1 进行全盘数据校验,校验过程中查看 zpool status -xv 是这样的:

  pool: mymir1
 state: ONLINE
status: One or more devices has experienced an error resulting in data
        corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
        entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub in progress since Mon Aug  9 11:45:14 2021
        1.62T scanned at 213M/s, 1.56T issued at 206M/s, 6.97T total
        0B repaired, 22.36% done, 07:40:10 to go
config:

        NAME        STATE     READ WRITE CKSUM
        mymir1      ONLINE       0     0     0
          da2       ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        <metadata>:<0x0>
        <metadata>:<0x3d>

这个池按照 scrub -> export -> import -> scrub -> export -> import 流程走一遍。第一个 scrub 修文件,第二个 scrub 执行后 zfs 检测不到错误 errors 就没有了。

跟据 Richard Elling 的说法: zpool statuserror buffer 包含最近两个 scrub 的结果信息。

因此,在删除异常的对象 ( 比如文件 ) 后,它仍然被列在错误缓冲区中。这时候用 zdb 查找 dataset+object tuple 找不到任何内容。所以要用两次 scrub 完全更新 error buffer 后, zpool status 才不会报错。



Last Update: 2023-07-10 Mon 14:52

Generated by: Emacs 28.2 (Org mode 9.5.5)   Contact: [email protected]

若正文中无特殊说明,本站内容遵循: 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议